package com.cecsmsserve.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("news")
public class News {
    
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    
    @TableField("title")
    private String title;
    
    @TableField("content")
    private String content;
    
    @TableField("author")
    private String author;
    
    @TableField("cover_image")
    private String coverImage;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("publish_time")
    private LocalDateTime publishTime;
    
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private LocalDateTime updateTime;
    
    @TableField("status")
    private Integer status; // 0-草稿，1-已发布
    
    @TableField("view_count")
    private Integer viewCount;
    
    @TableField("is_top")
    private Integer isTop; // 0-否，1-是
    
    @TableField("admin_id")
    private Integer adminId;
    
    @TableField(exist = false)
    private List<NewsCategory> categories;
    
    @TableField(exist = false)
    private List<NewsComment> comments;
    
    @TableField(exist = false)
    private String adminName;
} 